﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using NHibernate;
using FluentNHibernate.Data;

namespace BankCreditPortfolio.DAL.Entities
{
    public class GuarantorPersistence
    {
        public virtual int GuarantorId { get; set; }
        public virtual decimal Gains { get; set; }
        public virtual Profile Profile { get; set; }
        public virtual OrderInfoPersistence OrderInfo { get; set; }
        public virtual Currency GainsCurrency { get; set; }
    }

    public class Guarantor : GuarantorPersistence
    {
        new public OrderInfo OrderInfo { get; set; }
    }

    public class GuarantorMap : ClassMap<GuarantorPersistence>
    {
        public GuarantorMap()
        {
            Id(x => x.GuarantorId).GeneratedBy.HiLo("guarantor");
            Id(x => x.GuarantorId).Unique();
            Map(x => x.Gains);
            References(x => x.Profile).Column("ProfileId");
            References(x => x.OrderInfo).Column("OrderId");
            References(x => x.GainsCurrency).Column("CurrencyId");
            Table("Guarantor");
        }
    }
}
